<template>
    <div class="ab_banner">
        <div class="ab_title">
            <!-- <h1>雨过天晴</h1> -->
            <h1>{{ data.slogan }}</h1>
            <div class="slogan">
                <p>我有对策</p>
            </div>
        </div>
        <a-carousel :after-change="onChange" autoplay :autoplaySpeed="2000" arrows>
            <template #prevArrow>
                <div class="custom-slick-arrow" style="left: 10px; z-index: 1">
                    <left-circle-outlined />
                </div>
            </template>
            <template #nextArrow>
                <div class="custom-slick-arrow" style="right: 10px">
                    <right-circle-outlined />
                </div>
            </template>
            <div class="dynamic_banner" v-for="item in data.banners" :key="item.id">
                <img :src="item.path" alt="">
            </div>
            <!-- <div>
                <h3>
                    <img class="banner_image" alt="banner" src="http://image.fengfengzhidao.com/gvb_1009/20231123092743__1123-h.png">
                </h3>
            </div>
            <div>
                <h3>
                    <img class="banner_image" alt="banner" src="http://image.fengfengzhidao.com/gvb_1009/20231123092743__1123-i.png">
                </h3>
            </div>
            <div>
                <h3>
                    <img class="banner_image" alt="banner" src="http://image.fengfengzhidao.com/gvb_1009/20231123092743__1123-e.png">
                </h3>
            </div>
            <div>
                <h3>
                    <img class="banner_image" alt="banner" src="http://image.fengfengzhidao.com/gvb_1009/20231123092743__1123-a.png">
                </h3>
            </div> -->
        </a-carousel>

    </div>
</template>

<script setup lang="ts">
import { LeftCircleOutlined, RightCircleOutlined } from '@ant-design/icons-vue';
import { reactive } from 'vue';
import { getMenuDetailApi } from '@/api/menu_api'
const onChange = (current: number) => {
    console.log(current);
};

const props = defineProps({
    //对应文章的背景图
    url: {
        type: String
    },
    //对应文章标题
    title: {
        type: String,
    },
    //对应文章简介
    slogan: {
        type: String,
    }
})

const data = reactive({
    slogan: "",
    abstract: [],
    abstract_time: 6,
    banner_time: 6,
    banners: [],
})

async function getData() {
    let res = getMenuDetailApi(1)
    data.slogan = res.data.slogan
    data.abstract = res.data.abstract
    data.abstract_time = res.data.abstract_time
    data.banner_time = res.data.banner_time
    data.banners = res.data.banners
    console.log(res)
}

getData()
</script>

<style scoped lang="scss">
/* For demo */
:deep(.slick-slide) {
    // text-align: center;
    height: 600px;
    // line-height: 160px;
    background: #364d79;
    overflow: hidden;
}

:deep(.slick-slide h3) {
    color: #fff;
}

:deep(.slick-arrow.custom-slick-arrow) {
    width: 25px;
    height: 25px;
    font-size: 25px;
    color: #fff;
    background-color: rgba(31, 45, 61, 0.11);
    transition: ease all 0.3s;
    opacity: 0.3;
    z-index: 1;
}

:deep(.slick-arrow.custom-slick-arrow:before) {
    display: none;
}

:deep(.slick-arrow.custom-slick-arrow:hover) {
    color: #fff;
    opacity: 0.5;
}

.ab_banner {
    height: 600px;
    width: 100%;
    background-color: #2b3539;
    //   overflow: hidden;
    position: relative;

    .ab_title {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 10;
    }

    h1 {
        font-size: 30px;
        font-weight: 400;
        text-align: center;
        color: #fff;
    }

    .slogan {
        font-size: 18px;
        text-align: center;
    }

    img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }
}
</style>